ENV_ASIMUT	= MBK_CATAL_NAME=CATAL_ASIMUT

OBJECTIVES = translate boolean-optimization simulate-behavioral synthesis \
synthesis-optimization place route

all: $(OBJECTIVES)

translate: control_unit.vhdl hazard_fsm.vhdl fft_fsm.vhdl index_unit.vhdl \
op_unit.vhdl counter.vhdl
	vasy -Vaop control_unit
	vasy -Vaop hazard_fsm
	vasy -Vaop fft_fsm
	vasy -Vaop index_unit
	vasy -Vaop op_unit
	vasy -Vaop counter
	touch translate

simulate-behavioral: translate test_cu.pat
	$(ENV_ASIMUT) asimut control_unit test_cu result
	touch simulate-behavioral

test_cu.pat: test_cu.c
	genpat test_cu

boolean-optimization: translate
	boom hazard_fsm
	boom fft_fsm
	boom index_unit
	boom op_unit
	boom counter
	touch boolean-optimization

synthesis: boolean-optimization
	boog hazard_fsm_o hazard_fsm
	boog fft_fsm_o fft_fsm
	boog index_unit_o index_unit
	boog op_unit_o op_unit
	boog counter_o counter
	touch synthesis

synthesis-optimization: synthesis
	loon -o hazard_fsm
	loon -o fft_fsm
	loon -o index_unit
	loon -o op_unit
	loon -o counter
	touch synthesis-optimization

place-route: place route

place: synthesis-optimization
	ocp -ring control_unit control_unit
	touch place
	#ocp hazard_fsm hazard_fsm
	#ocp fft_fsm fft_fsm
	#ocp index_unit index_unit
	#ocp op_unit op_unit
	#ocp counter counter

route: place
	#nero -p hazard_fsm hazard_fsm hazard_fsm_nero
	#nero -p fft_fsm fft_fsm fft_fsm_nero
	#nero -p index_unit index_unit index_unit_nero
	#nero -p op_unit op_unit counter_nero
	#nero -p counter counter counter_nero
	nero -V -p control_unit control_unit control_unit_nero
	touch route

clean:
	rm -rf *.vbe \
		*.vst \
		*.xsc \
		*.pat \
		*.ap \
		$(OBJECTIVES) \
		*~
